using System;

namespace HuaXianQu.ProtoBuffEx.Runtime
{
    public class ProtoPathConfig : IProtoPathConfig
    {
        static IProtoPathConfig _ProtoPathConfig;

        public static IProtoPathConfig CurProtoPathConfig
        {
            get
            {
                if (_ProtoPathConfig == null)
                {
                    _ProtoPathConfig = new DefaultIProtoPathConfig();
                }

                return _ProtoPathConfig;
            }
            set => _ProtoPathConfig = value;
        }

        private static readonly Lazy<ProtoPathConfig> _inst = new Lazy<ProtoPathConfig>(() => new ProtoPathConfig());
        public static ProtoPathConfig Inst => _inst.Value;

        public bool IsDebug =>  CurProtoPathConfig.IsDebug;
        public bool IsUsedDLL => CurProtoPathConfig.IsUsedDLL;

        public string GenerateProtoCsRootPath
        {
            get
            {
                if (CurProtoPathConfig.IsUsedDLL)
                {
                    return CurProtoPathConfig.GenerateCsCachePath;
                }

                return CurProtoPathConfig.GenerateProtoCsRootPath;
            }
        }

        public string GenerateCsCachePath => CurProtoPathConfig.GenerateCsCachePath;
        public string GenerateProtoPath => CurProtoPathConfig.GenerateProtoPath;
        public string GenerateProtoDataPath => CurProtoPathConfig.GenerateProtoDataPath;

        public string GenerateProtoDllPath
        {
            get
            {
                if (CurProtoPathConfig.IsUsedDLL)
                {
                    return CurProtoPathConfig.GenerateProtoDllPath;
                }

                return CurProtoPathConfig.GenerateCsCachePath;
            }
        }

        public string ExcelPath => CurProtoPathConfig.ExcelPath;
        public string ProtocPath => CurProtoPathConfig.ProtocPath;
        public string GoogleProtobufPath => CurProtoPathConfig.GoogleProtobufPath;
        public string ProtoDllName => CurProtoPathConfig.ProtoDllName;
        public string PackagesPath => CurProtoPathConfig.PackagesPath;

    }
}